﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace WCS.Config
{
    public class AutoMapperConfig
    {
        public T2 MapperTo<T1,T2>(T1 sour)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap<T1, T2>();
                    //.ForMember(dest => dest.pltBoxNum, opt => opt.MapFrom(origin => origin.lightedCount))
                    //.ForMember(dest => dest.palletNo, opt => opt.MapFrom(origin => origin.printLPN));
            });
            var mapper = config.CreateMapper();
            var entity = mapper.Map<T1, T2>(sour);
            return entity;
        }
    }
}
